<template>
	<view>
		<view class="text_all" v-if="list&&form">
			<view class="text_all_1">
				<text class="text_10" @click="submit(item)" :style="{
					'font-weight':form.id!=item.id?'400':'600',
					'font-size':form.id!=item.id?'28rpx':'32rpx',
					'color':form.id!=item.id?'#666666':'#181818'
				}" v-for="(item,index) in list">{{item.name}}</text>
			</view>
			<text class="text_101" @click="to">更多></text>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			list: {
				type: Array,
				default: () => []
			},
			nav: {
				type: Object,
				default: () => {}
			}
		},
		data() {
			return {
				form: null,
			};
		},
		methods: {
			submit(item) {
				this.form = item
				this.$emit('onchang', item)
			},
			to(){
				if(this.nav&&this.nav.url){
					if(this.nav.type==1){
						uni.navigateTo({
							url:this.nav.url
						})
					}
				}else{
					uni.switchTab({
						url:'/pages/shoppingMall/shoppingMall'
					})
				}
			}
		},
		mounted() {
			this.form = this.list[0]
			this.$emit('onchang', this.form)
			console.log(this.form, '测试数据');
		}
	}
</script>

<style lang="scss">
	.text_102 {
		font-size: 32rpx;
		font-family: OPPOSans;
		// font-weight: bold;
		color: #181818;
	}

	.text_all {
		padding: 0rpx 30rpx 30rpx 30rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;

		.text_all_1 {
			width: 85%;
			display: flex;
			justify-content: space-between;



			.text_10 {
				font-size: 28rpx;
				font-family: OPPOSans;
				// font-weight: 400;
				color: #666666;
			}
		}


		.text_101 {
			font-size: 24rpx;
			font-family: OPPOSans;
			font-weight: 500;
			color: #999999;
		}


	}
</style>
